/*
 * Copyright ${.now?string("yyyy")} the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ${config.packageName}.bean;

<#if (apidocs)>import net.ymate.apidocs.annotation.ApiProperty;</#if>
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.io.Serializable;

/**
 * ${entityInfo.name?cap_first}Bean generated By EntityMojo on ${lastUpdateTime?string("yyyy/MM/dd HH:mm:ss")}
 *
 * @author YMP (https://www.ymate.net/)
 */
public class ${entityInfo.name?cap_first}Bean implements Serializable {

    private static final long serialVersionUID = 1L;

<#list entityInfo.primaryKeys as field>
    <#if (field.remarks!"undefined") != "undefined">/**
     * ${field.remarks}
     */</#if>
    <#if (apidocs)>@ApiProperty(description = "${field.remarks!"undefined"}", demoValue = "")</#if>
    private ${field.varType} ${field.varName};

</#list>

<#list entityInfo.fields as field>
    <#if field.varName != entityInfo.primaryKeyName || (entityInfo.primaryKeys?size == 0)>
    <#if (field.remarks!"undefined") != "undefined">/**
     * ${field.remarks}
     */</#if>
    <#if (apidocs)>@ApiProperty(description = "${field.remarks!"undefined"}", demoValue = "")</#if>
    private ${field.varType} ${field.varName};

    </#if>
</#list>

    public ${entityInfo.name?cap_first}Bean() {
    }

<#list entityInfo.primaryKeys as field>
    public ${field.varType} get${field.varName?cap_first}() {
        return ${field.varName};
    }

    public void set${field.varName?cap_first}(${field.varType} ${field.varName}) {
        this.${field.varName} = ${field.varName};
    }

</#list>
<#list entityInfo.fields as field>
    <#if field.varName != entityInfo.primaryKeyName || (entityInfo.primaryKeys?size == 0)>
    public ${field.varType} get${field.varName?cap_first}() {
        return ${field.varName};
    }

    public void set${field.varName?cap_first}(${field.varType} ${field.varName}) {
        this.${field.varName} = ${field.varName};
    }

    </#if>
</#list>
    @Override
    public String toString() {
        return new ToStringBuilder(this)<#list entityInfo.primaryKeys as field>
                .append("${field.varName}", ${field.varName})</#list><#list entityInfo.fields as field><#if field.varName != entityInfo.primaryKeyName || (entityInfo.primaryKeys?size == 0)>
                .append("${field.varName}", ${field.varName})</#if></#list>
                .toString();
    }

<#if (config.useChainMode)>
    public Builder bind() {
        return new Builder(this);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {

        private final ${entityInfo.name?cap_first}Bean targetBean;

        public Builder() {
            targetBean = new ${entityInfo.name?cap_first}Bean();
        }

        public Builder(${entityInfo.name?cap_first}Bean targetBean) {
            this.targetBean = targetBean;
        }

        public ${entityInfo.name?cap_first}Bean build() {
            return targetBean;
        }
    <#list entityInfo.primaryKeys as field>

        public ${field.varType} ${field.varName}() {
            return targetBean.get${field.varName?cap_first}();
        }

        public Builder ${field.varName}(${field.varType} ${field.varName}) {
            targetBean.set${field.varName?cap_first}(${field.varName});
            return this;
        }
    </#list>

    <#list entityInfo.fields as field>
        <#if field.varName != entityInfo.primaryKeyName || (entityInfo.primaryKeys?size == 0)>
        public ${field.varType} ${field.varName}() {
            return targetBean.get${field.varName?cap_first}();
        }

        public Builder ${field.varName}(${field.varType} ${field.varName}) {
            targetBean.set${field.varName?cap_first}(${field.varName});
            return this;
        }
        </#if>
    </#list>
    }
</#if>
}
